<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of Registro
 *
 * @author jmj J.Jesus Abarca Gonzalez
 */
class Registro extends BaseEncPersonaForm {
    
    public function configure() {

        $encuesta = EncEncuestaPeer::getActiveEncuestaByUsuario();

       unset(
                $this['created_at'],
                $this['updated_at'],
                $this['grupo_id'],
                $this['evaluacion_id'],
                $this['is_actived'],
               $this['encuesta_id'],
               $this['evaluacion_grupo']

        );

      $this->widgetSchema['password'] = new sfWidgetFormInputPassword();
      //$this->widgetSchema["encuesta_id"] = new sfWidgetFormInputHidden(array(),array("value"=>1));
      $this->setWidget('confirmar_password', new sfWidgetFormInputPassword());
      
     
       

      $this->mergeForm(new EncDireccionForm());

      unset($this['persona_id']);
      /**
       * mensaje estandar requerido
       */
      $requiredMsg = sfConfig::get('app_required_msg');
      /**
       * mensaje estandar invalido
       */
      $invalidMsg = sfConfig::get('app_invalid_msg');
      /**
         * validando email
         * mensaje para error en el email
         */
 /**
  * validando campos
  */
          $this->validatorSchema['confirmar_password'] = new sfValidatorString(array(),array('required'=>$requiredMsg,'invalid'=>$invalidMsg));
           $this->validatorSchema['email'] = new sfValidatorAnd(array(
                    $this->validatorSchema['email'],
                    new sfValidatorEmail(array(),array('required'=>$requiredMsg,'invalid'=>$invalidMsg)),
                ));
           $this->validatorSchema['nombre'] = new sfValidatorAnd($this->validatorSchema['nombre'], array(), array('required'=>$requiredMsg,'invalid'=>$invalidMsg));
           $this->validatorSchema['apellido_paterno'] = new sfValidatorAnd($this->validatorSchema['apellido_paterno'], array(), array('required'=>$requiredMsg,'invalid'=>$invalidMsg));
           $this->validatorSchema['apellido_materno'] = new sfValidatorAnd($this->validatorSchema['apellido_materno'], array(), array('required'=>$requiredMsg,'invalid'=>$invalidMsg));
           $this->validatorSchema['telefono'] = new sfValidatorAnd($this->validatorSchema['telefono'], array(), array('required'=>$requiredMsg,'invalid'=>$invalidMsg));
           $this->validatorSchema['password'] = new sfValidatorAnd($this->validatorSchema['password'], array(), array('required'=>$requiredMsg,'invalid'=>$invalidMsg));
           $this->validatorSchema['calle'] = new sfValidatorAnd($this->validatorSchema['calle'], array(), array('required'=>$requiredMsg,'invalid'=>$invalidMsg));
           $this->validatorSchema['numero'] = new sfValidatorAnd($this->validatorSchema['numero'], array(), array('required'=>$requiredMsg,'invalid'=>$invalidMsg));
           $this->validatorSchema['colonia'] = new sfValidatorAnd($this->validatorSchema['colonia'], array(), array('required'=>$requiredMsg,'invalid'=>$invalidMsg));
           $this->validatorSchema['delegacion_municipio'] = new sfValidatorAnd($this->validatorSchema['delegacion_municipio'], array(), array('required'=>$requiredMsg,'invalid'=>$invalidMsg));
           $this->validatorSchema['referencia'] = new sfValidatorAnd($this->validatorSchema['referencia'], array(), array('required'=>$requiredMsg,'invalid'=>$invalidMsg));
           $this->validatorSchema['estado'] = new sfValidatorAnd($this->validatorSchema['estado'], array(), array('required'=>$requiredMsg,'invalid'=>$invalidMsg));
           
/** 
 *  validando la confirmacion de la contraseña
 */
      
      $this->validatorSchema->setPreValidator(new sfValidatorSchemaCompare('password', "==", 'confirmar_password', array(),array('required'=>$requiredMsg,'invalid'=>'Los passwords no coinciden')));


    }

}
?>
